﻿// -------------------------------------------------------------------------
//    @FileName         :    NFCityMapUtil.h
//    @Author           :    Gao.Yi
//    @Date             :    2025-09-17
//    @Email			:    445267987@qq.com
//    @Module           :    NFCityMapUtil
//    @Desc             :
//
// -------------------------------------------------------------------------

#pragma once

#include "NFCityNeighborGrid.h"

class NFCityMapInst;
class NFCityWorldObject;
class NFCityPlayer;
class NFCityNpc;

class NFCityMapUtil
{
public:
    static int LeaveMap(NFCityWorldObject* pWorldObject);
    static int EnterMap(NFCityWorldObject* pWorldObject, NFCityMapInst* pMapInst, const Proto_Vector3& oEnterPos, int iDirection);
    static int EnterMap(NFCityWorldObject* pWorldObject, NFCityMapInst* pMapInst, const Proto_Vector3& oEnterPos, int iDirection, bool bNotifyEnterView);

public:
    static int InteractNeigborForEnterView(NFCityWorldObject* pActiveObject, NFCityNeighborGrid& oGrids);
    static int InteractNeigborForLeaveView(NFCityWorldObject* pActiveObject, NFCityNeighborGrid& oGrids);
    static int RefreshNeighborView(NFCityWorldObject* pActiveObject, NFCityNeighborGrid& oBeginGrids, NFCityNeighborGrid& oEndGrids);
    static int RefreshNeighborView(NFCityWorldObject* pActiveObject, NFCityMapInst* pMapInst, const Proto_Vector3& oEndPos);
    static int BroadCastNeighbor(NFCityWorldObject* pActiveObject, NFCityNeighborGrid& oGrids, int iCmd, google::protobuf::Message* pMessage);
    static int BroadCastViewNeighbor(NFCityPlayer* pPlayer, int iCmd, const google::protobuf::Message* pMessage);

public:
    static int SynAction(NFCityWorldObject* pActiveObject, NFCityPlayer* pAcceptPlayer);
    static int NotifyMapEnterRsp(NFCityPlayer* pPlayer);
    static int NotifyMapLeaveRsp(NFCityPlayer* pPlayer);
    static int ResetPos(NFCityWorldObject* pWo);
public:
    static int MakeRefreshView(NFCityWorldObject* pWorldObject, proto_ff::Proto_CSMapRefreshViewNtf* pRefreshViewNtf);
    static int MakeEnterView(NFCityWorldObject* pWorldObject, proto_ff::Proto_CSEnterViewNtf* pEnterViewNtf);
    static int MakeLeaveView(NFCityWorldObject* pWorldObject, proto_ff::Proto_CSLeaveViewNtf* pLeaveViewNtf);
    static int MakeLastAction(NFCityWorldObject* pWorldObject, bool& bIsAction, proto_ff::Proto_CSMapActionNtf* pActionNtf);
    static int MakePlayerEnterView(NFCityPlayer* pPlayer, proto_ff::CSViewOne* pViewOne);

private:
    static int MakeNpcEnterView(NFCityNpc* pNpc, proto_ff::CSViewOne* pViewOne);
};
